#include "Tetris3DApp.h"

Tetris3DApp::Tetris3DApp()
: m_pAppStateManager(NULL)
{
}

Tetris3DApp::~Tetris3DApp()
{
	OGRE_SAFE_DELETE(m_pAppStateManager);
	if (AppFramework::getSingletonPtr())
		OGRE_DELETE AppFramework::getSingletonPtr();
}

void Tetris3DApp::Run(const char* szPath)
{
	new AppFramework(szPath);
	if (!AppFramework::getSingletonPtr()->InitFmk("AppFramework", 0, 0))
		return;

	AppFramework::getSingletonPtr()->m_pLog->logMessage("Demo initialized!");

	m_pAppStateManager = new AppStateManager();

	MenuState::Create(m_pAppStateManager, "MenuState");
	GameState::Create(m_pAppStateManager, "GameState");
    PauseState::Create(m_pAppStateManager, "PauseState");

	m_pAppStateManager->Start(m_pAppStateManager->FindByName("MenuState"));
	//m_pAppStateManager->Start(m_pAppStateManager->FindByName("GameState"));
}
